<template>
  <div>
    <el-card class="box-card">
      <div>
        <h3>质量问题排查与治理</h3>
      </div>
      <el-collapse v-model="activeNames" @change="handleChange" :title="123">
        <!-- <el-collapse-item title="检查规则设置" name="1"> </el-collapse-item> -->
        <el-collapse-item title="复查时限设置" name="2">
          <div>
            注：根据级别设置复查时限（天），如未设置默认一般质量问题3天、重大质量问题2天
          </div>
          <div style="display: flex; justify-content: space-between">
            <span>一般质量问题</span>
            <el-input-number
              v-model="numData.configValue"
              @change="handleChangeUpdatanumData"
              :min="1"
              :max="10"
              label="描述文字"
            ></el-input-number>
          </div>
          <div style="display: flex; justify-content: space-between">
            <span>较大质量问题</span>
            <el-input-number
              v-model="moreDay.configValue"
              @change="handleChangeUpdataDanger"
              :min="1"
              :max="10"
              label="描述文字"
            ></el-input-number>
          </div>
          <div style="display: flex; justify-content: space-between">
            <span>重大质量问题</span>
            <el-input-number
              v-model="num.configValue"
              @change="handleChangeUpdata"
              :min="1"
              :max="10"
              label="描述文字"
            ></el-input-number>
          </div>
        </el-collapse-item>
      </el-collapse>
    </el-card>
  </div>
</template>

<script>
import {
  getSettings,
  getSettingsMajor,
  settingsUpdate,
  getSettingsmoreDay
} from "@/api/GeneralSettings";
export default {
  data() {
    return {
      activeNames: [],
      numData: {
        configId: null,
        configValue: null,
      },
      num: {
        configId: null,
        configValue: null,
      },
      moreDay: {
        configId: null,
        configValue: null,
      },
    };
  },

  methods: {
    handleChange(val) {
      if (val == "2") {
        getSettings().then((response) => {
          this.numData = response.data;
        });
        getSettingsMajor().then((response) => {
          this.num = response.data;
        });
        getSettingsmoreDay().then((response) => {
          this.moreDay = response.data
        })
      }
    },
    handleChangeUpdatanumData(value) {
      settingsUpdate(this.numData).then((response) => {});
    },
    handleChangeUpdata(value) {
      settingsUpdate(this.num).then((response) => {});
    },
    handleChangeUpdataDanger(value){
      settingsUpdate(this.moreDay).then((response) => {});
    }
  },

  components: {},

  computed: {},

  created() {},
};
</script>
<style scoped>
.box-card {
  margin: 0 20%;
}
</style>
